from  urllib import request
from  urllib import  parse
import  os
import  a1
import  re

#a1.run(input(),input())
print("路径设置略")
#music_id=input('请输入歌单ID : ')
music_id='981261555'
url='http://music.163.com/playlist?id='+music_id
req=request.Request(url=url,headers=a1.headers)
s2=request.urlopen(req).read().decode('utf-8','ignore')
d={"sss":100}
li=re.findall(r'<a href="/song.?id=([0-9]+)">(.*?)<',s2)
for i in li:
    idd=str(i[0])
    name=str(i[1])
    if idd in d:
        d[idd]=d[idd]+1
        print(d[idd])
        a1.run(idd, name + str(d[idd]))
    else:
        d[idd]=0
        a1.run(idd,name)
